package com.pdg.dungeondelver.engine;

import java.util.Iterator;
import java.util.Map;

import com.pdg.dungeondelver.configuration.Configuration;
import com.pdg.dungeondelver.configuration.Descriptor;

public class LayerColumn extends DescriptoredHashMap<Integer,LayerCell>{
	/**
	 * 
	 */
	private static final long serialVersionUID = -2952964840284020876L;
	private Layer atlasCellLayer;

	public LayerColumn(Layer theAtlasCellLayer){
		super(new Descriptor());
		setLayer(theAtlasCellLayer);
	}

	private void setLayer(Layer theAtlasCellLayer) {
		atlasCellLayer = theAtlasCellLayer;
	}
	
	public Layer getLayer(){
		return atlasCellLayer;
	}
	public Configuration getConfiguration(){
		return getLayer().getConfiguration();
	}
	public Atlas getAtlas(){
		return getLayer().getAtlas();
	}
	public Integer getColumnId(){
		Iterator<Map.Entry<Integer,LayerColumn>> iterator = getLayer().entrySet().iterator();
		while(iterator.hasNext()){
			Map.Entry<Integer,LayerColumn> entry = iterator.next();
			if(entry.getValue().equals(this)){
				return entry.getKey();
			}
		}
		return null;
	}
}
